package com.ay272.ssh2.base.biz;

import com.ay272.ssh2.base.dao.Dao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

/**
 * Created by java on 2016/5/17.
 */
@Service
@Transactional
public class    BaseBiz  <E extends Serializable,PK extends Serializable>{

    private Dao<E,PK> dao;

    public Dao<E, PK> getDao() {
        return dao;
    }
    //@Autowired
    public void setDao(Dao<E, PK> dao) {
        this.dao = dao;
    }
    public void save(E entity){
        dao.save(entity);
    }
    public void delete(E entity){
        dao.delete(entity);
    }
    public void update(E entity){
        dao.update(entity);
    }
    public E get(PK id){
        return dao.get(id);
    }
    public List<E> list(){
        return dao.list();
    }
}
